<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">

		<title>w1002</title>
	<script>
	window.onload=function(){
					var showTime=function(){함수실행코드};
					var d="<h3>"+new Date().toLocaleTimeString() +"</h3>";
					document.getElementById("s02").innerHTML = d;
					//일정시간에 한 번 호출 
					//window.setTimeout(showTime, 3000);
					//일정시간 간격으로 반복 호출
					var t = window.setInterval(showTime,1000);
					
					//Timer끄기 
					document.getElementById("s03").onclick=function(){
						setTimeout(function(){clearInterval(t);}, 3000);
					};
				};
	
		</script>
	</head>

	<body>
		<span id="s01" onclick="self.close();">창닫기</span>
		<span id="s03" onclick="clearInterval(t);">Timer</span>
		<div id="s02"></div>
	</body>
</html>
